<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{$current['title']}-{$Think.CONFIG.sitename}</title>

    <link href="__PUBLIC__/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/animate.min.css" rel="stylesheet">
    <include file="Public/commoncss" />
    <link href="__PUBLIC__/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/markdown/css/editormd.css" />
</head>

<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <include file="Public/header" />
        </div>
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-12 animated fadeInDown">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h4>{$current['title']}
                                <div class="ibox-tools">
                                    <a href="javascript:;" style="color:blue;" onclick="window.location.href='{:U('Words/index')}'">
                                        <i class="fa fa-list"></i>返回列表页
                                    </a>
                                </div>
                            </h4>
                        </div>
                        <div class="ibox-content">
                            <form class="form-horizontal m-t" action="{:U('update')}" id="myForm">

                                <div class="form-group">
                                    <div class="col-sm-10">
                                        <input  name="title" class="form-control" type="text" value="" datatype="*3-156" placeholder="笔记标题限制最多156个字符"  nullmsg="请填写笔记标题！" errormsg="笔记标题3-156个字符！" sucmsg="笔记标题验证通过！" autocomplete="off">
                                        <span class="help-block m-b-none Validform_checktip"></span>
                                    </div>
                                    <div class="col-xs-2">
                                        <select name="source" class="form-control m-b">
                                            <option value="1">工作笔记</option>
                                            <option value="2">代码笔记</option>
                                            <option value="3">摘抄笔记</option>
                                            <option value="4">私人笔记</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div id="test-editormd">
                                        <textarea name="content"  style="display:none;"></textarea>
                                        <span class="help-block m-b-none Validform_checktip"></span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        <if condition="$_COOKIE['no_read'] neq 1">
                                            <input type="checkbox" name="no_read" value="1">下次不再显示提示内容
                                        <else/>
                                            <input type="checkbox" name="no_read" value="1" checked>下次不再显示提示内容
                                        </if>
                                        <button class="btn btn-primary pull-right" type="submit">保存内容</button>
                                        <span class="help-block m-b-none " id="dump"></span>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <include file="Public/footer" />
    </div>
</div>
<include file="Public/commonjs" />
<script src="__PUBLIC__/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__PUBLIC__/static/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/static/js/plugins/validate/Validform_v5.3.2.js"></script>
<script src="__PUBLIC__/markdown/editormd.js"></script>
<script type="text/javascript">
    var testEditor;
    $(document).ready(function() {
        <if condition="$_COOKIE['no_read'] neq 1">
            $.get("__PUBLIC__/markdown/examples/test.md", function(md){
        <else/>
            $.get("__PUBLIC__/markdown/examples/no_read.md", function(md){
        </if>
            testEditor = editormd("test-editormd", {
                width: "98%",
                height: 730,
                path : '__PUBLIC__/markdown/lib/',
                markdown : md,
                codeFold : true,
                saveHTMLToTextarea : true,
                searchReplace : true,
                htmlDecode : "style,script,iframe|on*",
                emoji : true,
                taskList : true,
                tocm            : true,         // Using [TOCM]
                tex : true,                   // 开启科学公式TeX语言支持，默认关闭
                flowChart : true,             // 开启流程图支持，默认关闭
                sequenceDiagram : true,       // 开启时序/序列图支持，默认关闭,
                imageUpload : true,
                imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                imageUploadURL : "__PUBLIC__/markdown/examples/php/upload.php",
                onload : function() {
                    console.log('onload', this);
                }
            });
        });
        //提交表单
        $("#myForm").Validform({
            tiptype:function(msg,o,cssctl){
                if(!o.obj.is("form")){
                    var objtip=o.obj.siblings(".Validform_checktip");
                    cssctl(objtip,o.type);
                    objtip.text(msg);
                }else{
                    if(msg == '恭喜,操作成功！'){
                        window.location.href="{:U('Words/index')}";
                    }else{
                        var objtip=o.obj.find("#dump");
                        cssctl(objtip,o.type);
                        objtip.text(msg);
                    }
                }
            },
            ajaxPost:true
        });
    })
</script>
</body>

</html>